<script setup lang="ts">
import { ElDatePicker } from 'element-plus'

defineEmits<{
  (e: 'search'): void
}>()

const query = defineModel<{
  name: string
  year: string
}>({ required: true })
</script>

<template>
  <ElForm inline :model="query">
    <ElFormItem label="报表名称">
      <ElInput v-model="query.name" />
    </ElFormItem>
    <ElFormItem label="年份">
      <ElDatePicker
        v-model="query.year"
        type="year"
        value-format="YYYY"
      />
    </ElFormItem>
    <ElFormItem>
      <SearchButton @click="$emit('search')" />
    </ElFormItem>
  </ElForm>
</template>
